package com.sunshine.lnuplus.view;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.MenuItem;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.sunshine.lnuplus.R;

public class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SharedPreferences appSetting = getSharedPreferences("app_setting",MODE_PRIVATE);
        int theme = appSetting.getInt("theme",4);
        switch (theme){
            case 1:setTheme(R.style.blackTheme);break;
            case 2:setTheme(R.style.purpleTheme);break;
            case 3:setTheme(R.style.purple_deTheme);break;
            case 4:setTheme(R.style.pinkTheme);break;
            case 5:setTheme(R.style.yellowTheme);break;
            case 6:setTheme(R.style.blueTheme);break;
            case 7:setTheme(R.style.greenTheme);break;
            case 8:setTheme(R.style.whiteTheme);break;
        }
        System.out.println("hahah");

    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
